package 数组;

public class 移除元素 {
    class Solution{
        public int removeElement(int[] nums,int val){
            int fastIndex = 0;
            int slowIndex ;
            for ( slowIndex = 0; fastIndex < nums.length; fastIndex++) {
                if (nums[fastIndex] != val){
                    nums[slowIndex] = nums[fastIndex];
                    slowIndex++;
                }
            }
            return slowIndex;
        }
    }
}
